home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Packard Bell - Multimedia…D & Packard Bell Library
/
Packard Bell Master CD.iso
/
bu
/
o
/
pnp.141
/
diskimag
/
pnp
/
disk1.img
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1995-02-09
|
15KB
|
532 lines
'******************************************************************************
'** Auto-configuration software setup script
'******************************************************************************
''$DEFINE DUMPLIST
''$DEFINE NOCOPY
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'' WINDOWS SYSTEM ID's
CONST IDYES = 6
CONST IDNO = 7
'' Message Box ID's
CONST MB_YESNO = 4
CONST MB_ICONQUSTION = 32
'' Dialog ID's
CONST WELCOME = 100
CONST DONTUSE = 150
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST LOGO = 1 '' bitmap ID - identifies bitmap in DIALOGS.RC
'' GLOBAL VARAIBLES
GLOBAL DEST$ '' destination directory
GLOBAL YESNO%
GLOBAL szESCD%
'' function declarations
DECLARE SUB Install
DECLARE SUB AddDosDriver( szFile$, szDevText$ )
DECLARE SUB CommentOutVxD( szVxD$, szWindowsDir$ )
DECLARE FUNCTION MakePath( szDir$, szFile$ ) AS STRING
DECLARE SUB AddBuffers
''String Defs.
YESNOMSG$ = "An ESCD.RF file has been detected. Do you want to overwrite it ?"
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
'' put opening bitmap on the screen
SetBitmap CUIDLL$, LOGO
SetTitle "Plug and Play Kit for Windows"
'' figure out where the .INF file is and read it
szInf$ = GetSymbolValue( "STF_SRCINFPATH" )
IF szInf$ = "" THEN
szInf$ = GetSymbolValue( "STF_CWDDIR" ) + "SETUP.INF"
END IF
ReadInfFile szInf$
'' identify the default Plug and Play installation directory
DEST$ = "C:\PLUGPLAY"
WELCOME:
SetAbout "Plug and Play Kit for Windows", "Copyright 1993, 1994 Intel Corporation, All Rights Reserved"
sz$ = UIStartDlg( CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$ )
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
DONTUSE:
sz$ = UIStartDlg( CUIDLL$, DONTUSE, "FInfoDlgProc", APPHELP, HELPPROC$ )
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
'' present window for user to select Plug and Play install directory
sz$ = UIStartDlg( CUIDLL$, DESTPATH, "FEditDlgProc", 0, "" )
DEST$ = GetSymbolValue( "EditTextOut" )
IF sz$ = "CONTINUE" THEN
IF IsDirWritable( DEST$ ) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
'' Check to see if there is enough space on the target disk.
CKSIZE:
DRIVE$ = MID$(DEST$,1,1)
FREE& = GetFreeSpaceForDrive(drive$)
IF FREE < 2500000 THEN
GOTO TOOBIG
EndIf
ISESCD:
szESCD% = DoesFileExist("C:\ESCD.RF", fenExists)
If szESCD% = 1 Then
yesno% = DoMsgBox( YESNOMSG$, "ESCD.RF FOUND", MB_YESNO+MB_ICONQUESTION)
EndIF
If ( szESCD% =1 and yesno% = IDYES) THEN
BackupFile "C:\ESCD.RF", "ESCD.BAK"
EndIf
'' We have an installation directory and know where the Windows directory
'' and the Windows SYSTEM directory are. Now call the Install subroutine
'' to do the real work
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg( CUIDLL$, dlg%, "FInfo0DlgProc", 0, "" )
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox( "Software installation is incomplete", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND )
END
BADPATH:
sz$ = UIStartDlg( CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "" )
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg( CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "" )
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
TOOBIG:
sz$ = UIStartDlg( CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "" )
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
ELSEIF sz$ = "CONTINUE" THEN
UIPop 1
dlg% = EXITFAILURE
GOTO QUITL1
END IF
RETURN
'******************************************************************************
'** subroutine: Install
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'******************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue( "STF_SRCDIR" )
'' create Plug and Play installation directory
''
CreateDir DEST$, cmoVital
'' create subdirectories for ICU, ICU\DB, and DRIVERS\DOS
''
ICUdir$ = MakePath( DEST$, "ICU" )
CreateDir ICUdir$, cmoVital
DBdir$ = MakePath( ICUdir$, "DB" )
CreateDir DBdir$, cmoVital
CMdir$ = MakePath( DEST$, "DRIVERS" )
CreateDir CMdir$, cmoVital
DCMdir$ = MakePath( CMdir$, "DOS" )
CreateDir DCMdir$, cmoVital
'' locate Windows installation directory and SYSTEM subdirectory
''
WinDir$ = GetWindowsDir()
WinSys$ = GetWindowsSysDir()
SysIni$ = WinDir$ + "SYSTEM.INI"
SysBak$ = MakePath( DEST$, "SYSTEM.BAK" )
'' Remove old readme files from previous installations
RemoveFile ICUdir$ + "\README.WIN", cmoForce
RemoveFile ICUdir$ + "\README.DOS", cmoForce
RemoveFile ICUdir$ + "\README.CM", cmoForce
RemoveFile DEST$ + "\README.CM", cmoForce
RemoveFile DEST$ + "\README.DDK", cmoForce
'' Remove !dec2030,2040,2050 cfg files
RemoveFile DBdir$ + "\!dec2030.cfg", cmoForce
RemoveFile DBdir$ + "\!dec2040.cfg", cmoForce
RemoveFile DBdir$ + "\!dec2050.cfg", cmoForce
'' create file copy list from sections in .INF file
''
AddSectionFilesToCopyList "ICU_readme", SrcDir$, DEST$
AddSectionFilesToCopyList "ICU_binaries", SrcDir$, ICUdir$
AddSectionFilesToCopyList "ICU_database", SrcDir$, DBdir$
AddSectionFilesToCopyList "ESCD_image", SrcDir$, DCMdir$
AddSectionFilesToCopyList "DOS_CM_binaries", SrcDir$, DCMdir$
AddSectionFilesToCopyList "Win_CM_binaries", SrcDir$, WinSys$
AddSectionFilesToCopyList "ICU_winsys", SrcDir$, WinSys$
If ( (szESCD% =1 AND YESNO% = IDYES) OR (szESCD% = 0)) THEN
AddSectionFilesToCopyList "ESCD_image", SrcDir$, "C:\"
EndIf
'$IFDEF DUMPLIST
DumpCopyList "C:\~WINICU.LST"
'$ENDIF
'$IFNDEF NOCOPY
'' copy files to appropriate locations
CopyFilesInCopyList
'' create WINICU.INI in the Windows directory with the installation values
'' [Pathnames]
'' ICUDir=C:\PLUGPLAY\ICU
'' Database=DB
'' Indexfile=ICU.NDX
'' Imagefile=SYSTEM.IMG
''
'' note that Setup does not create the [Settings] section or any keys in it;
'' WinICU creates/updates these at runtime
''
ICUini$ = WinDir$ + "WINICU.INI"
RemoveIniKey ICUini$, "Settings", "HideUnchangeableCards", cmoNone
CreateIniKeyValue ICUini$, "Pathnames", "ICUDir", ICUdir$, cmoOverwrite
CreateIniKeyValue ICUini$, "Pathnames", "Database", "DB", cmoOverwrite
CreateIniKeyValue ICUini$, "Pathnames", "Indexfile", "ICU.NDX", cmoOverwrite
CreateIniKeyValue ICUini$, "Pathnames", "Imagefile", "SYSTEM.IMG", cmoOverwrite
'$ENDIF '' NOCOPY
'' add a DEVICE= line for the DOS CM driver in CONFIG.SYS
''
szDevText$ = MakePath( DCMdir$, "DWCFGMG.SYS" )
AddBuffers
AddDosDriver "DWCFGMG.SYS", szDevText$
'$IFNDEF NOCOPY
'' check for a key in WIN.INI - if there is none, create one and add the CM
'' drivers to SYSTEM.INI
''
sz$ = GetIniKeyString( "WIN.INI", "ConfigMgr", "Installed" )
IF sz$ = "yes" THEN
GOTO VXDINSTALLED
END IF
CreateIniKeyValue "WIN.INI", "ConfigMgr", "Installed", "yes", cmoNone
'' backup SYSTEM.INI, then add device entries for CA and CM in [386Enh] section
''
CopyFile SysIni$, SysBak$, cmoOverwrite, 0
CreateSysIniKeyValue SysIni$, "386Enh", "device", "VCAD.386", cmoVital
CreateSysIniKeyValue SysIni$, "386Enh", "device", "VCMD.386", cmoVital
CreateSysIniKeyValue SysIni$, "386Enh", "device", "PCCARDRM.386", cmoVital
CommentOutVxD "PCCARDRM.386", WinDir$
VXDINSTALLED:
'' create Plug and Play program group in Program Manager - contains ICU
'' executable and README.TXT
''
CreateProgmanGroup "Plug and Play", "", cmoNone
ShowProgmanGroup "Plug and Play", 1, cmoNone
CreateProgmanItem "Plug and Play", "Intel ISA Configuration Utility", MakePath( ICUdir$,"WINICU.EXE" ), "", cmoOverwrite
CreateProgmanItem "Plug and Play", "Release Notes", "NOTEPAD.EXE "+MakePath( DEST$,"README.TXT" ), "", cmoOverwrite
CreateProgmanItem "Plug and Play", "ICU User's Guide", "WINHELP.EXE "+MakePath( ICUdir$,"ICUUG.HLP" ), "", cmoOverwrite
'$ENDIF '' NOCOPY
MKNDX:
CHDRIVE DEST$
CHDIR DEST$ + "\ICU\DB"
SHELL DEST$ + "\ICU\DB\CFGNDX.EXE"
CHDRIVE szInf$
END SUB
'******************************************************************************
'**
'** subroutine: AddDosDriver
'**
'** Purpose: Adds a DEVICE=<file> entry to CONFIG.SYS for the specified file.
'** An existing line in CONFIG.SYS with the same filename will be
'** deleted. If CONFIG.SYS doesn't exist, a new one is created.
'** An existing CONFIG.SYS is renamed CONFIG.BAK.
'**
'** Arguments:
'** szFile$ - filename of driver
'** szDevText$ - driver pathname and invocation options, e.g.,
'** "C:\PLUGPLAY\DRIVERS\DOS\DWCFGMG.SYS"
'**
'******************************************************************************
SUB AddDosDriver( szFile$, szDevText$ ) STATIC
'' read CONFIG.SYS and write CONFIG.NEW line by line. delete any line with a
'' matching driver name
''
OPEN "C:\CONFIG.NEW" FOR OUTPUT AS #2
PRINT #2, "DEVICE="; szDevText$
IF NOT EXISTS( "C:\CONFIG.SYS" ) THEN
cfg% = 0
GOTO NOCFGSYS
END IF
cfg% = 1
OPEN "C:\CONFIG.SYS" FOR INPUT AS #1
WHILE NOT( EOF( 1 ) )
LINE INPUT #1, szLine$
szTest$ = UCASE$( szLine$ )
pos% = INSTR( szTest$, szFile$ )
IF pos% = 0 THEN
PRINT #2, szLine$
END IF
WEND
NOCFGSYS:
CLOSE #2
IF cfg% = 1 THEN
CLOSE #1
IF EXISTS( "C:\CONFIG.BAK" ) THEN
KILL "C:\CONFIG.BAK"
END IF
NAME "C:\CONFIG.SYS" AS "C:\CONFIG.BAK"
END IF
NAME "C:\CONFIG.NEW" AS "C:\CONFIG.SYS"
END SUB
'******************************************************************************
'**
'** subroutine: CommentOutVxD
'**
'** Purpose: Puts a comment character in front of a VxD invocation in
'** the windows\system.ini file.
'**
'** Arguments:
'** szVxD$ - name of VxD
'** szWindowsDir$ - The windows directory: e.g. c:\windows\
'**
'******************************************************************************
SUB CommentOutVxD ( szVxD$, szWindowsDir$ ) STATIC
'' read system.ini and write system.new line by line.
''
szCurDir$=CURDIR$
CHDRIVE szWindowsDir$
szWinDirNoSlash$=MID$ (szWindowsDir,1,LEN(szWindowsDir)-1)
CHDIR szWinDirNoSlash$
OPEN szWindowsDir$ + "SYSINI.NEW" FOR OUTPUT AS #2
OPEN szWindowsDir$ + "SYSTEM.INI" FOR INPUT AS #1
WHILE NOT( EOF( 1 ) )
LINE INPUT #1, szLine$
szTest$ = UCASE$( szLine$ )
pos% = INSTR( szTest$, szVxD$ )
IF pos% = 0 THEN
PRINT #2, szLine$
ELSE
PRINT #2, ";"; szLine$
END IF
WEND
CLOSE #2
CLOSE #1
IF EXISTS( "SYSINI.BAK" ) THEN
KILL "SYSINI.BAK"
END IF
NAME "SYSTEM.INI" AS "SYSINI.BAK"
NAME "SYSINI.NEW" AS "SYSTEM.INI"
CHDRIVE szCurDir$
CHDIR szCurDir$
END SUB
'******************************************************************************
'**
'** function: MakePath
'**
'** Purpose: Appends a file name to the end of a directory path, inserting a
'** backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'******************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
'******************************************************************************
'**
'** subroutine: AddBuffers
'**
'** Purpose: Checks to see if the entry in CONFIG.SYS for BUFFERS=<Buffer #)
'** ig greater or equal to 20. If not BUFFERS will be set to 20.
'** If CONFIG.SYS doesn't exist, a new one is created.
'** An existing CONFIG.SYS is renamed CONFIG.BAK.
'**
'** Arguments:
'** szBUF$ - filename of driver
'**
'**
'**
'******************************************************************************
SUB AddBuffers STATIC
'' read CONFIG.SYS and write CONFIG.NEW line by line.
''
''
DIDBUF = 0
OPEN "C:\CONFIG.NEW" FOR OUTPUT AS #2
IF NOT EXISTS( "C:\CONFIG.SYS" ) THEN
cfg% = 0
GOTO WRITENEWCFG
END IF
cfg% = 1
OPEN "C:\CONFIG.SYS" FOR INPUT AS #1
WHILE NOT( EOF( 1 ) )
LINE INPUT #1, szLine$
szTest$ = UCASE$( szLine$ )
pos% = INSTR( szTest$, "BUFFERS=")
IF pos% = 0 THEN
PRINT #2, szLine$
ELSE
szBUFFS$ = szLine$
BUF% = VAL(MID$ (szTEST$, 9, 2))
IF BUF >= 20 AND DIDBUF = 0 then
PRINT #2, szBUFFS$
DIDBUF = 1
ELSE
PRINT #2, "BUFFERS=20"
DIDBUF = 1
END IF
END IF
WEND
WRITENEWCFG:
IF cfg% = 0 THEN
PRINT #2, "BUFFERS=20"
End IF
CLOSE #2
IF cfg% = 1 THEN
CLOSE #1
IF EXISTS( "C:\CONFIG.BAK" ) THEN
KILL "C:\CONFIG.BAK"
END IF
NAME "C:\CONFIG.SYS" AS "C:\CONFIG.BAK"
END IF
NAME "C:\CONFIG.NEW" AS "C:\CONFIG.SYS"
END SUB